package com.fz.us.admin.company.entity;

import javax.persistence.*;
import java.util.Set;

/**
 * 实体类 - 岗位
 * ============================================================================
 * 版权所有 2016 。
 *
 * @author fallenpanda
 * @version 1.0 2016-07-25 。
 * ============================================================================
 */
@Entity
@Table(name="sys_post")
public class Post extends CompanyEntity {

    private static final long serialVersionUID = -2542145914332273773L;
    /**
     * 令牌(要舍弃)
     */
    private String value;
    /**
     * 描述
     */
    private String description;
    /**
     * 排序
     */
    private int sortNo;
    /**
     * 标识
     */
    private String pname;

    /**
     * 部门
     */
    private Set<Department> departmentSet;
    /**
     * 职权
     */
    private Set<Power> powerSet;


    @Column(length = 5000)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Column(nullable = false)
    public int getSortNo() {
        return sortNo;
    }

    public void setSortNo(int sortNo) {
        this.sortNo = sortNo;
    }

    @OneToMany(mappedBy = "post", fetch = FetchType.LAZY)
    @OrderBy("name asc")
    public Set<Power> getPowerSet() {
        return powerSet;
    }

    public void setPowerSet(Set<Power> powerSet) {
        this.powerSet = powerSet;
    }

    public String getPname() {
        return pname;
    }

    public void setPname(String pname) {
        this.pname = pname;
    }

    @ManyToMany(cascade = {CascadeType.ALL},fetch = FetchType.LAZY, mappedBy = "postSet")
    @OrderBy("name asc")
    public Set<Department> getDepartmentSet() {
        return departmentSet;
    }

    public void setDepartmentSet(Set<Department> departmentSet) {
        this.departmentSet = departmentSet;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
